﻿using MyManager.Business;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyManager.Data
{
    public class CategoryXMLDataManager : ICategoryDataManager

    {
        CategoryCollection _categoryCollection;

        public CategoryXMLDataManager()
        {

            _categoryCollection = XMLHelper.deserializeXMLToObject<CategoryCollection>();
            if (null == _categoryCollection) _categoryCollection = new CategoryCollection();
        }

        public Category Create(Category category)
        {
            category.Id = XMLHelper.getUniqueId();
            _categoryCollection.Add(category);
            int result = XMLHelper.serializeObjectToXML(_categoryCollection);
            return category;
        }

       

        public CategoryCollection GetAllCategories()
        {
            return _categoryCollection;
        }

        public CategoryCollection GetChildCategories(string parentCategoryId)
        {
            throw new NotImplementedException();
        }

        public Category GetCategoryById(string categoryId)
        {
            throw new NotImplementedException();
        }

        public CategoryCollection GetCategoriesByName(string categoryId)
        {
            throw new NotImplementedException();
        }

        public CategoryCollection GetCategoriesById(System.Collections.Specialized.StringCollection categoryIds)
        {
            throw new NotImplementedException();
        }
    }
}
